// var t = require("../../../helper/account.js"),
var app = getApp();

Component({
  properties: {
    data: { type: Object },
    tabTitle: { type: String },
    option: { type: Object },
    isEdit: { type: Number,default:0 },
  },
  data: { dpr: 2, imgurl: app.getImgUrl(), },
  attached: function () {
    var t = wx.getSystemInfoSync();
    this.setData({ dpr: t.pixelRatio });
  },
  methods: {
    goEdit(e){
      this.triggerEvent("edit",e)
    },
    goLink: function (a) {
      if(this.data.isEdit == 0){
        var i = a.currentTarget.dataset.item, s = i.id, n = i.activityId, d = i.name, r = a.currentTarget.dataset.index, 
        c = "/pages/product/detail/index?id=" + s;
        n && (c += "&activityId=" + n), c += "&sa_unit=goodsList";
        var o = this.data.option;//, l = o.firstname, y = o.firstindex, f = o.secondname, g = o.secondindex, 
        var m = {
          classify_url: app.getUrl(),
          commodity_id: s,
          commodity_name: d,
          commodity_index: 1 + ~~r
        };
        app.setStorageSync("classifyyieldtrace", m)
        app.setStorageSync("sendType", "classify")
        app.goUrl(c); 
        // app.saTrack("classify2_click", {
        //     ad_floor: a.currentTarget.dataset.index,
        //     ad_link: c,
        //     user_id: (0, app.getUserId)() || 0,
        //     $title: "分类-" + this.data.tabTitle,
        //     $url: app.getUrl()
        // });
      }
    }
  }
});